//用户登录注册部分请求封装管理

import request from "./request";

//发送验证码
export const getCode = (phoneNum: number | string) =>
  request({ method: "get", url: `user/passport/sendCode/${phoneNum}` });

//注册
interface RegisterParamas {
  phone: string;
  password: string;
  code: string;
}
export const register = (registerParamas: RegisterParamas) => {
  console.log(registerParamas);

  return request({
    method: "post",
    url: "/user/passport/register",
    data: registerParamas,
  });
};

//登录
interface LoginInfo {
  phone: string;
  password: string;
}
export const login = (loginInfo: LoginInfo) =>
  request({ method: "post", url: "/user/passport/login", data: loginInfo });

//验证token
export const verifyToken = () =>
  request({ method: "get", url: "/user/passport/auth/getUserInfo" });

//获取用户地址
export const getUserAddress = () =>
  request({ method: "get", url: "/user/userAddress/auth/findUserAddressList" });
